package com.xxx.video.mine.presenters;

import android.content.Context;

import androidx.annotation.NonNull;

import com.xxx.video.commen.presenters.BasePresenter;
import com.xxx.video.commen.utils.ResponseUtils;
import com.xxx.video.login.beans.UserInfoBean;
import com.xxx.video.network.listeners.CommonResponseListener;
import com.xxx.video.network.utils.NetWorkUtils;

public class MinePresenter extends BasePresenter<IMineView> {

    public MinePresenter(@NonNull Context context, IMineView baseView) {
        super(context, baseView);
    }


    /**
     * get person info
     */
    public void getPersonInfo() {
        NetWorkUtils.getInstance().getUser(new CommonResponseListener<UserInfoBean>() {
            @Override
            public void onSuccess(UserInfoBean successOb, String result) {
                if (getBaseView() != null) {
                    getBaseView().showRootLayoutStatus(1);
                }
                if (ResponseUtils.getInstance().isNoError(successOb)) {
                    if (getBaseView() != null) {
                        getBaseView().initUserInfoData2View(successOb);
                    }
                }
            }

            @Override
            public void onFailure(Object failureObj) {
                if (getBaseView() != null) {
                    getBaseView().showRootLayoutStatus(1);
                }
            }
        });

    }
}
